package IssueFuction;

import issue.Issue;
import issue.IssueList;

import java.util.Scanner;

public class AlterFunctions implements IFunctions{
    @Override
    public void work(IssueList issueList) {
        System.out.println("修改问题");
        int currentSize=issueList.getUsedSize();
        for (int i = 0; i < currentSize; i++) {//先显示一遍所有问题
            Issue issue=issueList.getIssues(i);
            System.out.println(issue);
        }
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要修改的问题序号:");
        int chose=scanner.nextInt();
        System.out.println("请输入你修改后的问题");
        String content=scanner.next();
        Issue tmp=null;//媒介
        for (int i = 0; i < currentSize; i++) {
            if (issueList.getIssues(i).getNumber()==chose){
                tmp=issueList.getIssues(i);//找到对应问题就记录
                break;
            }
        }
        tmp.setContent(content);
        System.out.println("修改成功");
    }
}
